import request from '../../utils/request'

/**
 * 新增物流订单
 *
 */
export async function add(data) {
    return request(apiPath.zbtie + "/api/logistics/order", {
        method: 'post',
        data
    });
}


/**
 * 修改物流订单
 *
 */
export async function update(data) {
    return request(apiPath.zbtie + "/api/logistics/order", {
        method: 'put',
        data
    });
}

/**
 * 删除物流订单
 *
 */
export async function deleteById({ id }) {
    return request(apiPath.zbtie + "/api/logistics/order/" + id, {
        method: 'delete'
    });
}

/**
 *根据id获取物流订单
 *
 */
export async function getById({ id }) {
    return request(apiPath.zbtie + "/api/logistics/order/" + id, {
        method: 'get'
    });
}


/**
 * 分页获取港口列表
 *
 */
export async function getListForPage({loadingPort, destinationPort, supplierName, orderNo, sealNumber, cntrNo, contractNo, ieOrderNo,
                                        beginTime, endTime, ywUser,page }) {
    return request(apiPath.zbtie + "/api/logistics/order", {
        method: 'get',
        data: { loadingPort, destinationPort, supplierName, orderNo, sealNumber, cntrNo, contractNo, ieOrderNo, beginTime, endTime, ywUser,
          page: page.page, size: page.size }
    });
}

/**
 * 更新补料
 * @param data
 * @returns {Promise<*>}
 */
export async function updateOdsi(data) {
  return request(apiPath.zbtie + "/api/logistics/orderSi", {
    method: 'put',
    data
  });
}

/**
 * 更新拖车
 * @param data
 * @returns {Promise<*>}
 */
export async function updateOdTrailer(data) {
    return request(apiPath.zbtie + "/api/logistics/odTrailer", {
        method: 'put',
        data
    });
}

/**
 * 更新报关
 * @param data
 * @returns {Promise<*>}
 */
export async function updateOdDeclare(data) {
    return request(apiPath.zbtie + "/api/logistics/odDeclare", {
        method: 'put',
        data
    });
}
